package cate.game.play.buff.h;

import cate.common.util.XT;
import cate.game.play.buff.BuffHandler;
import cate.game.play.buff.BuffParam;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.fighter.HealResult;
import cate.game.play.proce.action.ctx.SkillActionCtx;

import java.util.List;

/**
 * 溢出治疗量转化为护盾
 */
public class 治疗溢出护盾BH extends BuffHandler {

	private List<Integer> 目标技能;

	private List<String> 目标标签;

	private double 系数;

	private int 护盾buff;

	//目标技能=？？&目标标签=？？
	//系数=10000&护盾buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		目标技能 = args.getIntList("目标技能");
		目标标签 = args.getStrList("目标标签");
		系数 = args.getWDouble("系数", 10000d);
		护盾buff = args.getInt("护盾buff", 0);
	}

	@Override
	public void onActiveHeal(SkillActionCtx action, Fighter target, HealResult healResult) {
		if (healResult.overFlowHeal <= 0) {
			return;
		}
		if (XT.isNotBlank(目标技能) && !目标技能.contains(action.getSkill().tid)) {
			return;
		}
		if (XT.isNotBlank(目标标签) && !action.getSkill().cfg.containTags(目标标签)) {
			return;
		}
		BuffParam param = new BuffParam().buffHpSet(healResult.overFlowHeal * 系数);
		target.buff.tryAddByTid(action, buff.owner, 护盾buff, param);
	}
}
